﻿@model OAWeb.Models.LoginViewModel


@using (Html.BeginForm()) 
{
    @Html.AntiForgeryToken()
    
<div class="form-horizontal">
    <h4>登录</h4>
    <hr />
    @Html.ValidationSummary(true, "", new { @class = "text-danger" })
    <div class="form-group">
        @Html.LabelFor(model => model.Email, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" })
        </div>
    </div>

    <div class="form-group">
        @Html.LabelFor(model => model.Password, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => model.Password, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.Password, "", new { @class = "text-danger" })
        </div>
    </div>


    <div class="form-group">
        @Html.LabelFor(model => model.ValidCode, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => model.ValidCode, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.ValidCode, "", new { @class = "text-danger" })
        </div>
    </div>


    <div id="row" style="width:320px; height:100px;margin-left:195px ">
        <img id="valiCode" style="cursor: pointer; width :100px;height:50px;" class="col-md-2 control-label" src="~/Account/GetValidateCode" alt="验证码" />
        <a id="switchCode" href="javascript:void(0);" style="text-decoration:none;">看不清？ 请点击图片更换</a>
    </div>

    <div class="form-group">
        @Html.LabelFor(model => model.RememberMe, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            <div class="checkbox">
                @Html.EditorFor(model => model.RememberMe)
                @Html.ValidationMessageFor(model => model.RememberMe, "", new { @class = "text-danger" })
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <input type="submit" value="登录" class="btn btn-default" />
            <button class="btn btn-default">@Html.ActionLink("注册", "Register", "Account")</button>
        </div>
    </div>
</div>
}

@*<div>
    @Html.ActionLink("返回", "Index")
</div>*@

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
        <script type="text/javascript">
            $(function () {
                $("#valiCode").bind("click", function () {
                    this.src = "../Account/GetValidateCode?time=" + (new Date()).getTime();
                });
            });
            
        </script>
        }
